3.15 \(\int \frac {\sin ^2(x)}{a+b \cot (x)} \, dx\)

Optimal. Leaf size=72 \[ \frac {a x \left (a^2+3 b^2\right )}{2 \left (a^2+b^2\right )^2}-\frac {\sin ^2(x) (a \cot (x)+b)}{2 \left (a^2+b^2\right )}-\frac {b^3 \log (a \sin (x)+b \cos (x))}{\left (a^2+b^2\right )^2} \]

[Out]

1/2*a*(a^2+3*b^2)*x/(a^2+b^2)^2-b^3*ln(b*cos(x)+a*sin(x))/(a^2+b^2)^2-1/2*(b+a*cot(x))*sin(x)^2/(a^2+b^2)

________________________________________________________________________________________

Rubi [A]  time = 0.13, antiderivative size = 72, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.462, Rules used = {3506, 741, 801, 635, 203, 260} \[ \frac {a x \left (a^2+3 b^2\right )}{2 \left (a^2+b^2\right )^2}-\frac {\sin ^2(x) (a \cot (x)+b)}{2 \left (a^2+b^2\right )}-\frac {b^3 \log (a \sin (x)+b \cos (x))}{\left (a^2+b^2\right )^2} \]

Antiderivative was successfully verified.

[In]

Int[Sin[x]^2/(a + b*Cot[x]),x]

[Out]

(a*(a^2 + 3*b^2)*x)/(2*(a^2 + b^2)^2) - (b^3*Log[b*Cos[x] + a*Sin[x]])/(a^2 + b^2)^2 - ((b + a*Cot[x])*Sin[x]^
2)/(2*(a^2 + b^2))

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 741

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> -Simp[((d + e*x)^(m + 1)*(a*e + c*d*x)*(
a + c*x^2)^(p + 1))/(2*a*(p + 1)*(c*d^2 + a*e^2)), x] + Dist[1/(2*a*(p + 1)*(c*d^2 + a*e^2)), Int[(d + e*x)^m*
Simp[c*d^2*(2*p + 3) + a*e^2*(m + 2*p + 3) + c*e*d*(m + 2*p + 4)*x, x]*(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a
, c, d, e, m}, x] && NeQ[c*d^2 + a*e^2, 0] && LtQ[p, -1] && IntQuadraticQ[a, 0, c, d, e, m, p, x]

Rule 801

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(
(d + e*x)^m*(f + g*x))/(a + c*x^2), x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[c*d^2 + a*e^2, 0] && Integer
Q[m]

Rule 3506

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(b*f), Subst
[Int[(a + x)^n*(1 + x^2/b^2)^(m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && NeQ[a^2 + b
^2, 0] && IntegerQ[m/2]

Rubi steps

\begin {align*} \int \frac {\sin ^2(x)}{a+b \cot (x)} \, dx &=-\frac {\operatorname {Subst}\left (\int \frac {1}{(a+x) \left (1+\frac {x^2}{b^2}\right )^2} \, dx,x,b \cot (x)\right )}{b}\\ &=-\frac {(b+a \cot (x)) \sin ^2(x)}{2 \left (a^2+b^2\right )}+\frac {b \operatorname {Subst}\left (\int \frac {-2-\frac {a^2}{b^2}-\frac {a x}{b^2}}{(a+x) \left (1+\frac {x^2}{b^2}\right )} \, dx,x,b \cot (x)\right )}{2 \left (a^2+b^2\right )}\\ &=-\frac {(b+a \cot (x)) \sin ^2(x)}{2 \left (a^2+b^2\right )}+\frac {b \operatorname {Subst}\left (\int \left (-\frac {2 b^2}{\left (a^2+b^2\right ) (a+x)}+\frac {-a^3-3 a b^2+2 b^2 x}{\left (a^2+b^2\right ) \left (b^2+x^2\right )}\right ) \, dx,x,b \cot (x)\right )}{2 \left (a^2+b^2\right )}\\ &=-\frac {b^3 \log (a+b \cot (x))}{\left (a^2+b^2\right )^2}-\frac {(b+a \cot (x)) \sin ^2(x)}{2 \left (a^2+b^2\right )}+\frac {b \operatorname {Subst}\left (\int \frac {-a^3-3 a b^2+2 b^2 x}{b^2+x^2} \, dx,x,b \cot (x)\right )}{2 \left (a^2+b^2\right )^2}\\ &=-\frac {b^3 \log (a+b \cot (x))}{\left (a^2+b^2\right )^2}-\frac {(b+a \cot (x)) \sin ^2(x)}{2 \left (a^2+b^2\right )}+\frac {b^3 \operatorname {Subst}\left (\int \frac {x}{b^2+x^2} \, dx,x,b \cot (x)\right )}{\left (a^2+b^2\right )^2}-\frac {\left (a b \left (a^2+3 b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{b^2+x^2} \, dx,x,b \cot (x)\right )}{2 \left (a^2+b^2\right )^2}\\ &=\frac {a \left (a^2+3 b^2\right ) x}{2 \left (a^2+b^2\right )^2}-\frac {b^3 \log (a+b \cot (x))}{\left (a^2+b^2\right )^2}-\frac {b^3 \log (\sin (x))}{\left (a^2+b^2\right )^2}-\frac {(b+a \cot (x)) \sin ^2(x)}{2 \left (a^2+b^2\right )}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C]  time = 0.19, size = 94, normalized size = 1.31 \[ \frac {2 a^3 x-a^3 \sin (2 x)+b \left (a^2+b^2\right ) \cos (2 x)-2 b^3 \log \left ((a \sin (x)+b \cos (x))^2\right )+6 a b^2 x-a b^2 \sin (2 x)-4 i b^3 x+4 i b^3 \tan ^{-1}(\tan (x))}{4 \left (a^2+b^2\right )^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]^2/(a + b*Cot[x]),x]

[Out]

(2*a^3*x + 6*a*b^2*x - (4*I)*b^3*x + (4*I)*b^3*ArcTan[Tan[x]] + b*(a^2 + b^2)*Cos[2*x] - 2*b^3*Log[(b*Cos[x] +
 a*Sin[x])^2] - a^3*Sin[2*x] - a*b^2*Sin[2*x])/(4*(a^2 + b^2)^2)

________________________________________________________________________________________

fricas [A]  time = 0.50, size = 94, normalized size = 1.31 \[ -\frac {b^{3} \log \left (2 \, a b \cos \relax (x) \sin \relax (x) - {\left (a^{2} - b^{2}\right )} \cos \relax (x)^{2} + a^{2}\right ) - {\left (a^{2} b + b^{3}\right )} \cos \relax (x)^{2} + {\left (a^{3} + a b^{2}\right )} \cos \relax (x) \sin \relax (x) - {\left (a^{3} + 3 \, a b^{2}\right )} x}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(a+b*cot(x)),x, algorithm="fricas")

[Out]

-1/2*(b^3*log(2*a*b*cos(x)*sin(x) - (a^2 - b^2)*cos(x)^2 + a^2) - (a^2*b + b^3)*cos(x)^2 + (a^3 + a*b^2)*cos(x
)*sin(x) - (a^3 + 3*a*b^2)*x)/(a^4 + 2*a^2*b^2 + b^4)

________________________________________________________________________________________

giac [B]  time = 0.80, size = 148, normalized size = 2.06 \[ -\frac {a b^{3} \log \left ({\left | a \tan \relax (x) + b \right |}\right )}{a^{5} + 2 \, a^{3} b^{2} + a b^{4}} + \frac {b^{3} \log \left (\tan \relax (x)^{2} + 1\right )}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} + \frac {{\left (a^{3} + 3 \, a b^{2}\right )} x}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} - \frac {b^{3} \tan \relax (x)^{2} + a^{3} \tan \relax (x) + a b^{2} \tan \relax (x) - a^{2} b}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} {\left (\tan \relax (x)^{2} + 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(a+b*cot(x)),x, algorithm="giac")

[Out]

-a*b^3*log(abs(a*tan(x) + b))/(a^5 + 2*a^3*b^2 + a*b^4) + 1/2*b^3*log(tan(x)^2 + 1)/(a^4 + 2*a^2*b^2 + b^4) +
1/2*(a^3 + 3*a*b^2)*x/(a^4 + 2*a^2*b^2 + b^4) - 1/2*(b^3*tan(x)^2 + a^3*tan(x) + a*b^2*tan(x) - a^2*b)/((a^4 +
 2*a^2*b^2 + b^4)*(tan(x)^2 + 1))

________________________________________________________________________________________

maple [B]  time = 0.24, size = 173, normalized size = 2.40 \[ -\frac {b^{3} \ln \left (a \tan \relax (x )+b \right )}{\left (a^{2}+b^{2}\right )^{2}}-\frac {\tan \relax (x ) a^{3}}{2 \left (a^{2}+b^{2}\right )^{2} \left (1+\tan ^{2}\relax (x )\right )}-\frac {\tan \relax (x ) b^{2} a}{2 \left (a^{2}+b^{2}\right )^{2} \left (1+\tan ^{2}\relax (x )\right )}+\frac {a^{2} b}{2 \left (a^{2}+b^{2}\right )^{2} \left (1+\tan ^{2}\relax (x )\right )}+\frac {b^{3}}{2 \left (a^{2}+b^{2}\right )^{2} \left (1+\tan ^{2}\relax (x )\right )}+\frac {b^{3} \ln \left (1+\tan ^{2}\relax (x )\right )}{2 \left (a^{2}+b^{2}\right )^{2}}+\frac {3 \arctan \left (\tan \relax (x )\right ) b^{2} a}{2 \left (a^{2}+b^{2}\right )^{2}}+\frac {\arctan \left (\tan \relax (x )\right ) a^{3}}{2 \left (a^{2}+b^{2}\right )^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/(a+b*cot(x)),x)

[Out]

-b^3/(a^2+b^2)^2*ln(a*tan(x)+b)-1/2/(a^2+b^2)^2/(1+tan(x)^2)*tan(x)*a^3-1/2/(a^2+b^2)^2/(1+tan(x)^2)*tan(x)*b^
2*a+1/2/(a^2+b^2)^2/(1+tan(x)^2)*a^2*b+1/2/(a^2+b^2)^2/(1+tan(x)^2)*b^3+1/2/(a^2+b^2)^2*b^3*ln(1+tan(x)^2)+3/2
/(a^2+b^2)^2*arctan(tan(x))*b^2*a+1/2/(a^2+b^2)^2*arctan(tan(x))*a^3

________________________________________________________________________________________

maxima [A]  time = 0.94, size = 120, normalized size = 1.67 \[ -\frac {b^{3} \log \left (a \tan \relax (x) + b\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {b^{3} \log \left (\tan \relax (x)^{2} + 1\right )}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} + \frac {{\left (a^{3} + 3 \, a b^{2}\right )} x}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} - \frac {a \tan \relax (x) - b}{2 \, {\left ({\left (a^{2} + b^{2}\right )} \tan \relax (x)^{2} + a^{2} + b^{2}\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(a+b*cot(x)),x, algorithm="maxima")

[Out]

-b^3*log(a*tan(x) + b)/(a^4 + 2*a^2*b^2 + b^4) + 1/2*b^3*log(tan(x)^2 + 1)/(a^4 + 2*a^2*b^2 + b^4) + 1/2*(a^3
+ 3*a*b^2)*x/(a^4 + 2*a^2*b^2 + b^4) - 1/2*(a*tan(x) - b)/((a^2 + b^2)*tan(x)^2 + a^2 + b^2)

________________________________________________________________________________________

mupad [B]  time = 0.35, size = 126, normalized size = 1.75 \[ {\cos \relax (x)}^2\,\left (\frac {b}{2\,\left (a^2+b^2\right )}-\frac {a\,\mathrm {tan}\relax (x)}{2\,\left (a^2+b^2\right )}\right )-\frac {b^3\,\ln \left (b+a\,\mathrm {tan}\relax (x)\right )}{{\left (a^2+b^2\right )}^2}+\frac {\ln \left (\mathrm {tan}\relax (x)-\mathrm {i}\right )\,\left (2\,b+a\,1{}\mathrm {i}\right )}{4\,\left (-a^2+a\,b\,2{}\mathrm {i}+b^2\right )}+\frac {\ln \left (\mathrm {tan}\relax (x)+1{}\mathrm {i}\right )\,\left (a+b\,2{}\mathrm {i}\right )}{4\,\left (-a^2\,1{}\mathrm {i}+2\,a\,b+b^2\,1{}\mathrm {i}\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/(a + b*cot(x)),x)

[Out]

cos(x)^2*(b/(2*(a^2 + b^2)) - (a*tan(x))/(2*(a^2 + b^2))) - (b^3*log(b + a*tan(x)))/(a^2 + b^2)^2 + (log(tan(x
) - 1i)*(a*1i + 2*b))/(4*(a*b*2i - a^2 + b^2)) + (log(tan(x) + 1i)*(a + b*2i))/(4*(2*a*b - a^2*1i + b^2*1i))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\sin ^{2}{\relax (x )}}{a + b \cot {\relax (x )}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)**2/(a+b*cot(x)),x)

[Out]

Integral(sin(x)**2/(a + b*cot(x)), x)

________________________________________________________________________________________